Rework Garmin transparency device matching to work with more devices. From Google.
authorrobertl <robertl>
Sat, 21 Feb 2009 19:06:26 +0000 (19:06 +0000)
committerrobertl <robertl>
Sat, 21 Feb 2009 19:06:26 +0000 (19:06 +0000)
jeeps/gpslibusb.c

index 2075c4b770f854659b4ff55cb89eaf72bbda4a0e..3397c2c7b54d1576b680a2644221897be738e126 100644 (file)
@@ -359,20 +359,17 @@ int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number)
                struct usb_device *dev;
 
                for (dev = bus->devices; dev; dev = dev->next) {
-                       /* Probably too promiscious of a match, but since
-                        * Garmin doesn't document the _proper_ matching,
-                        * we just take the easy way out for now.
-                        * Unfortunatey, blowing on DeviceClass == Mass storage
-                        * doesn't work on CO, at least.
+                       /* 
+                        * Exclude Mass Storage devices (CO, OR, Nuvi, etc.) 
+                        * from this scan.
+                        * At least on Mac, bDeviceClass isn't 
+                        * USB_MASS_STORAGE as it should be (perhaps because
+                        * the storage driver has already bound to it?) so
+                        * we fondle only the proprietary class devices.
                         */
                        if (dev->descriptor.idVendor == GARMIN_VID && 
-                                                               dev->config) {
-                               switch (dev->descriptor.idProduct) {
-                                       case 0x19:  // Nuvi;
-                                       case 0x2244:  // Zumo;
-                                       case 0x2295:  // CO;
-                                               continue;
-                               }
+                           dev->config &&
+                               dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC ) {
                                if (req_unit_number < 0) {
                                        garmin_usb_start(dev, lud);     
                                        /*